﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InnovaApp.Layers.MetaDataLayer;
using System.Web.Mvc;
using InnovaApp.Layers.ResourcesLayer.Properties;

namespace InnovaApp.Portals.MVC4Portal.Models.MetaModels.OrderManagement
{
    public class OrderDetail_MetaModel : OrderDetail_MetaData
    {
        public enum enOrderDetailRowMode
        {
            _notSet,
            Add,
            Remove
        }

        private enOrderDetailRowMode _rowMode { get; set; }
        public List<SelectListItem> Products { get; set; }
		//Usually this is forbidden...
		public enOrderDetailRowMode RowMode
        {
            get
            {
                return _rowMode;
            }
            set
            {
                _rowMode = value;
                switch (_rowMode)
                {
                    case enOrderDetailRowMode.Add:
                        this.AddRemoveButtonCaption = "+";
                        break;
                    case enOrderDetailRowMode.Remove:
                        AddRemoveButtonCaption = "x";
                        break;
                    default:
                        AddRemoveButtonCaption = string.Empty;
                        break;
                }
            }
        }
        public string AddRemoveButtonCaption { get; private set; }

        public OrderDetail_MetaModel()
            : base()
        {
            this.Products = new List<SelectListItem>();
            this.RowMode = enOrderDetailRowMode._notSet;
            Products.Add(new SelectListItem() { Value = "-1", Text = "", Selected = true });
        }
        public OrderDetail_MetaModel(int orderId)
            : base()
        {
            base.Id = -99;
            this.RowMode = enOrderDetailRowMode.Add;
            base.FK_Order = orderId;
        }
    }
}
